package com.youpai.platform.vulture.service.handler.vulture;

import com.youpai.platform.common.exceptions.RemoteException;
import com.youpai.platform.vulture.common.entity.AccessMessage;
import com.youpai.platform.vulture.service.channel.VultureChannel;


/**
 * @date: 2022/7/8 22:43
 * @author: Anna
 * @version: 1.0
 * @description: channel事件处理handler
 */
public interface IVultureChannelHandler {


    /**
     * 建立连接
     *
     * @param channel 通道
     * @throws RemoteException 异常信息
     */
    void connect(VultureChannel channel) throws RemoteException;

    /**
     * 通道关闭
     *
     * @throws RemoteException 异常
     */
    void disConnect(VultureChannel vultureChannel) throws RemoteException;

    /**
     * 发送消息
     *
     * @throws RemoteException 异常
     */
    void send(VultureChannel vultureChannel, AccessMessage accessMessage) throws RemoteException;

    /**
     * 接收消息
     *
     * @throws RemoteException 异常
     */
    void receive(VultureChannel vultureChannel, AccessMessage accessMessage) throws RemoteException;

    /**
     * 异常
     *
     * @throws RemoteException 异常
     */
    void caught() throws RemoteException;
}
